package businesslogic;

import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class AnalyzedPage{
	public AnalyzedPage(String url, Date dateAdded){
		this.url = url;
		this.dateAdded = dateAdded;
		nameToInfoMap = new HashMap<String, EntityInfo>();
	}
	private String url;
	private Date dateAdded;
	private List<EntityInfo> entityInfoList;
	public Map<String, EntityInfo> nameToInfoMap;
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public Date getDateAdded() {
		return dateAdded;
	}
	public void setDateAdded(Date dateAdded) {
		this.dateAdded = dateAdded;
	}
	
	public String toString(){
		String analyzedEntitiesList = "";
		Set s = nameToInfoMap.entrySet();
		Iterator it=s.iterator();
		while(it.hasNext()){
			Map.Entry m =(Map.Entry)it.next();
			String key=(String)m.getKey();
			EntityInfo value=(EntityInfo)m.getValue();
			analyzedEntitiesList += key + "\n" + value.toString() + "\n";
		}
		return "entities from URL: " + url + "\nadded on: " + dateAdded + "\n" + analyzedEntitiesList;
	}
}
